#!/usr/bin/env python
#
#   compiledb: Tool for generating LLVM Compilation Database
#   files for make-based build systems.
#
#   Copyright (c) 2019 Nick Diego Yamane <nick.diego@gmail.com>
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
from os import path

data_dir = path.abspath(path.join(path.dirname(__file__), 'data'))


def full_path(relpath):
    return path.join(data_dir, relpath)


def input_file(relpath):
    relpath = '{}'.format(relpath)
    return open(full_path(relpath), 'r')


def output_file(relpath):
    relpath = '{}'.format(relpath)
    return open(full_path(relpath), 'a+')
